package com.baor.dao;

import com.baor.domain.CouponVo;
import com.github.yulichang.base.mapper.MPJJoinMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface CouponDao extends MPJJoinMapper<CouponVo> {
    List<CouponVo> list(Map<String,Object> params);
    @Select(" select DISTINCT a.coupon_id,a.coupon_name,CASE\n" +
            "        WHEN a.coupon_type = 0 THEN \"通用券\"\n" +
            "        when a.coupon_type = 1 then \"品类券\"\n" +
            "        when a.coupon_type = 2 then \"商品券\"\n" +
            "        END as coupon_type,a.coupon_money,a.coupon_number,CASE\n" +
            "        WHEN coupon_manual= 0 THEN \"是\"\n" +
            "        when coupon_manual = 1 then \"否\"\n" +
            "        END as coupon_manual,\n" +
            "        (select count(*) from t_coupon_user where coupon_id = a.coupon_id and status  = 1) as coupon_used,\n" +
            "        (select count(*) from t_coupon_user where coupon_id = a.coupon_id and status  = 0) as coupon_receive,coupon_usedTime,coupon_receiveTime,\n" +
            "        CASE\n" +
            "        WHEN coupon_condition = 0 THEN \"是\"\n" +
            "        when coupon_condition = 1 Then \"否\"\n" +
            "        END as coupon_condition\n" +
            "        from t_coupon a left join t_coupon_user b on a.coupon_id = b.coupon_id")
    List<CouponVo> couponList();
    @Select("select separate_id,separate_name from t_separate")
    List<Map<String,Object>> separateList();
    @Select("select goods_id,goods_name from t_goods")
    List<Map<String,Object>> goodsList();
    Map<String,Object> findPageCount(Map<String,Object> params);
}
